import { NodeViewWrapper, type ReactNodeViewProps } from "@tiptap/react";

export function TagComponent(props: ReactNodeViewProps<HTMLLabelElement>) {
  const increase = () => {
    props.updateAttributes({ count: props.node.attrs.count + 1 });
  };

  return (
    <NodeViewWrapper className="react-component">
      <label ref={props.ref}>React Components</label>

      <div className="content">
        <button onClick={increase}>按钮点击 {props.node.attrs.count}</button>
      </div>
    </NodeViewWrapper>
  );
}
